package com.yesep.learn.design.common.pojo;

import com.yesep.learn.design.common.*;

import java.util.*;

public abstract class ComputerComponent implements IComputerComponent {

    String model;

    double consumption;

    Map<String, Object> parameters;

    @Override
    public String getModel() {
        return model;
    }

    @Override
    public void setModel(String model) {
        this.model = model;
    }

    @Override
    public double getConsumption() {
        return consumption;
    }

    @Override
    public void setConsumption(double consumption) {
        this.consumption = consumption;
    }


    @Override
    public Map<String, Object> getParameters() {
        return parameters;
    }

    @Override
    public void setParameters(Map<String, Object> parameters) {
        this.parameters = parameters;
    }


    @Override
    public void start() {
        System.out.printf("The %s %s is start working. \n", this.getClass().getSimpleName().toLowerCase(), getModel());
    }

    @Override
    public void stop() {
        System.out.printf("The %s %s is stop working. \n", this.getClass().getSimpleName().toLowerCase(), getModel());
    }

    @Override
    public String toString() {
        return String.format("Component{model='%s',consumption=%.2f}", model, consumption);
    }
}
